package com.panda.business.controller.user;

import com.panda.business.domain.CommontermType;
import com.panda.business.domain.req.CommontermTypeVo;
import com.panda.business.service.CommontermTypeService;
import com.panda.common.core.controller.BaseController;
import com.panda.framework.domain.base.PageBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@Api("用户信息管理")
@Controller
@RequestMapping("/user/commontermtype")
public class CommontermTypeController extends BaseController {
	
	@Autowired
	private CommontermTypeService service;
   
    /**
     * 信息修改
     * @param user
     * @return
     */
    @ApiOperation("信息修改")
    @ResponseBody
    @RequestMapping(value = "/edit" ,method = RequestMethod.POST)
    public String edit(CommontermType user,HttpServletRequest request){
        user.setCid(1);
    	return service.update(user);
    }
    
    /**
     * 信息添加
     * @return
     */
    @ApiOperation("信息添加")
    @ResponseBody
    @RequestMapping(value = "/add" ,method = RequestMethod.POST)
    public String add(@RequestBody CommontermType user, HttpServletRequest request){
    	user.setCid(1);
    	return service.insert(user);
    }

    /**
     * 列表
     * @return
     */
    @ApiOperation("列表")
    @ResponseBody
    @RequestMapping(value = "/page" ,method = RequestMethod.POST)
    public  PageBean<CommontermType> page(CommontermTypeVo info, HttpServletRequest request){
        PageBean<CommontermType> commontermTypePageBean = service.queryCommontermType(info);
        return commontermTypePageBean;
    }
}
